package org.jeecg.modules.demo.houseOrder.service.impl;

import org.jeecg.modules.demo.houseOrder.entity.HouseOrder;
import org.jeecg.modules.demo.houseOrder.mapper.FyCostMapper;
import org.jeecg.modules.demo.houseOrder.mapper.ExpenseMapper;
import org.jeecg.modules.demo.houseOrder.mapper.HouseOrderMapper;
import org.jeecg.modules.demo.houseOrder.service.IHouseOrderService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.Collection;

/**
 * @Description: 入库单
 * @Author: jeecg-boot
 * @Date:   2021-12-13
 * @Version: V1.0
 */
@Service
public class HouseOrderServiceImpl extends ServiceImpl<HouseOrderMapper, HouseOrder> implements IHouseOrderService {

	@Autowired
	private HouseOrderMapper houseOrderMapper;
	@Autowired
	private FyCostMapper fyCostMapper;
	@Autowired
	private ExpenseMapper expenseMapper;
	
	@Override
	@Transactional
	public void delMain(String id) {
		fyCostMapper.deleteByMainId(id);
		expenseMapper.deleteByMainId(id);
		houseOrderMapper.deleteById(id);
	}

	@Override
	@Transactional
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			fyCostMapper.deleteByMainId(id.toString());
			expenseMapper.deleteByMainId(id.toString());
			houseOrderMapper.deleteById(id);
		}
	}
	
}
